perm filename VEE.MF[MF,DEK] blob
sn#754261 filedate 1984-05-11 generic text, type T, neo UTF8
% here's another file from that same lecture
delimiters (); % it begins with the same old stuff
% (which will eventually be put into the "plain base" file for MF)
% (MF will eventually be rigged to start with "plain base" already loaded)
vardef z@#=(x@#,y@#) enddef;
edges e; e=nulledges;
def fill expr x = addto e contour x withweight 1 enddef;
def erase expr x = addto e contour x withweight -1 enddef;
def down=(0,-1) enddef;
def up=(0,1) enddef;
def left=(-1,0) enddef;
def right=(1,0) enddef;
openwindow 1 from (0,0) to (400,450) at (-100,300);
proofing:=1;
smoothing:=1; autorounding:=2;
charcode:=96;
def next= charcode:=charcode+1;
display e on 1; shipout e; e:=nulledges; numeric x[],y[],x[]l,x[]r,y[]l,y[]r;
enddef;
def toplabel = makelabel(" 1") enddef;
def leftlabel = makelabel(" 2") enddef;
def rightlabel = makelabel(" 3") enddef;
def botlabel = makelabel(" 4") enddef;
def autolabel = makelabel(" 5") enddef;
def makelabel(expr s)(text t) =
forsuffixes $:=t:
special s&str$; numspecial x$; numspecial y$; endfor enddef;
def proofrule(expr a,b) =
special "rule"; numspecial xpart a; numspecial ypart a;
numspecial xpart b; numspecial ypart b enddef;
def proofoffset primary x =
special "offset"; numspecial xpart x; numspecial ypart x enddef;
pausing:=1;
"straight V"; % bold V using straight strokes
capheight=250; % its height
rightedge=150; % its width
thickwidth=50; thinwidth=40; % stroke widths at left and right
delta=5; % extra width allowed at the bottom
x1l=0; x1r=x1l+thickwidth;
x2l=x2r-thinwidth; x2r=rightedge;
y1l=y1r=y2l=y2r=capheight;
y3l=y3r=y4l=y4r=0;
x3l-x1l=x2r-x4r;
x4r-x3l=thickwidth+delta;
x3r-x3l=thickwidth; x4r-x4l=thinwidth;
fill z3l..z1l&z1l..z1r&z1r..z3r&z3r..z3l&cycle;
fill z4r..z2r&z2r..z2l&z2l..z4l&z4l..z4r&cycle;
toplabel(1l,1r,2l,2r);
leftlabel(3l);
rightlabel(4r);
botlabel(4l,3r);
next;
"changed to leave a notch";
notchheight=(thickwidth+thinwidth)/2;
x1l=0; x1r=x1l+thickwidth;
x2l=x2r-thinwidth; x2r=rightedge;
y1l=y1r=y2l=y2r=capheight;
y3l=y3r=0;
x3l-x1l=x2r-x3r;
x3r-x3l=thickwidth+delta;
y4=notchheight;
(x4-x3l)/(x3r-x3l) = thickwidth/(thickwidth+thinwidth);
fill z3l..z1l & z1l..z1r
& z1r{z3l-z1l}..z4-(.5,0){down}..z3l{left}
& cycle;
fill z3r..z2r & z2r..z2l
& z2l{z3r-z2r}..z4+(.5,0){down}..z3r{right}
& cycle;
autolabel(1l,1r,2l,2r,3l,3r,4);
next;
pausing:=0;
"same, with the bottom filled in";
x1l=0; x1r=x1l+thickwidth;
x2l=x2r-thinwidth; x2r=rightedge;
y1l=y1r=y2l=y2r=capheight;
y3l=y3r=0;
x3l-x1l=x2r-x3r;
x3r-x3l=thickwidth+delta;
y4=notchheight;
(x4-x3l)/(x3r-x3l) = thickwidth/(thickwidth+thinwidth);
fill z3l..z1l & z1l..z1r
& z1r{z3l-z1l}..z4-(.5,0){down}..z3l{left}
& cycle;
fill z3r..z2r & z2r..z2l
& z2l{z3r-z2r}..z4+(.5,0){down}..z3r{right}
& cycle;
message "The notch program was just repeated.";
message "Now let's also do this, to finish the V:"; pausing:=1;
fill z3l{up}..z4{right}..z3r{down}
& z3r..z3l & cycle;
autolabel(1l,1r,2l,2r,3l,3r,4);
next;
end